package com.bwie.goods.service.impl;

import com.bwie.goods.vo.ActivityVo;
import com.bwie.goods.vo.GoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.miaosha.common.utils.PageUtils;
import com.bwie.miaosha.common.utils.Query;

import com.bwie.goods.dao.OrderInfoDao;
import com.bwie.goods.entity.OrderInfoEntity;
import com.bwie.goods.service.OrderInfoService;


@Service("orderInfoService")
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoDao, OrderInfoEntity> implements OrderInfoService {
    @Autowired
    private OrderInfoDao orderInfoDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<OrderInfoEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("user_Id",params.get("userId"));
        IPage<OrderInfoEntity> page = this.page(
                new Query<OrderInfoEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

    @Override
    public OrderInfoEntity findOrderById(Long id) {
        return orderInfoDao.findOrderById(id);
    }

    @Override
    public OrderInfoEntity findOrderByOrderno(String orderno) {
        return orderInfoDao.findOrderByOrderno(orderno);
    }

    @Override
    public ActivityVo findOrderByGoodId(Long goodsId) {
        return orderInfoDao.findOrderByGoodId(goodsId);
    }

    @Override
    public OrderInfoEntity check(Long userId, Long goodsId) {
        return orderInfoDao.check(userId,goodsId);
    }

}